﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="Country.aspx.cs" Inherits="Admin_Country" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" Runat="Server">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
       
        <td>
          <div id="heading2"><asp:Label ID="lblHeading1" runat="server" CssClass="headingPart1"></asp:Label><asp:Label ID="lblHeading2" runat="server" CssClass="headingPart2"></asp:Label></div>
          <div id="main_text">
            <br />
            <h2>Country</h2>
                <table cellpadding="2" class="TableWithBorder" style="width:100%">
                        <tr>
                            <td class="Highlight" align="center">
                                <asp:Label ID="lblTopMsg" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                        
                        <asp:Panel ID="pnlSearch" runat="server" >
                                <table class="TableWithoutBorder" style="width:100%">
                                    <tr>
                                        <td style="width:25%" align="right">
                                          <asp:Label ID="lblSearchCountryname" runat="server" Text="Country Name:" 
                                                AssociatedControlID="txtSearchCountryname"></asp:Label>
                                        </td>
                                        <td style="width:25%" align="left">
                                          <asp:TextBox ID="txtSearchCountryname" runat="server" CssClass="StandardTextBox" 
                                                MaxLength="15"></asp:TextBox>
                                        </td>
                                        <td style="width:25%" align="right">
                                          
                                        </td>
                                        <td style="width:25%" align="left">
                                         
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4" align="center">
                                            <table class="TableWithoutBorder" style="width:50%">
                                                <tr>
                                                    <td>
                                                        <asp:ImageButton ID="ImgSearch" runat="server" ImageUrl="~/images/search.jpg" 
                                                             /></td>
                                                    <td>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                                
                             </asp:Panel>
                              </td>
                        </tr>
                        
                        <tr>
                            <td align="center">
                                <table class="TableWithoutBorder" style="width:70%">
                                <tr>
                                    <td style="width:50%">
                                       
                                         <asp:LinkButton ID="lnkAddCountry" runat="server" Text="Add Country"></asp:LinkButton>
                                    </td>
                                    <td style="width:50%">
                                      
                                    </td>
                                </tr>
                                </table>
                                
                                
                                 
                            </td>
                        </tr>
                        <tr>
                            <td>
                            <br />
                            <asp:GridView  id="gvCountry"  DataSourceID="odsCountry"
                            DataKeyNames="country_id"  AutoGenerateColumns="False"  CssClass="Grid" Runat="server" 
                             width="100%"
                                    OnSelectedIndexChanged="gvCountry_SelectedIndexChanged" AllowPaging="True" 
                                    onpageindexchanged="gvCountry_PageIndexChanged" 
                                    EmptyDataText="No Data Found">
                                <RowStyle HorizontalAlign="Center" />
                                <EmptyDataRowStyle HorizontalAlign="Center" />
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
        <asp:LinkButton
            id="lnkEdit"
            Text="Edit"
            CommandName="Select"
            Runat="server" OnClick="lnkEdit_Click" />
            /
        <asp:LinkButton
            id="LinkButton1"
            Text="Delete"
            CommandName="Delete"
            OnClientClick="return confirm('Are you sure that you want to delete this User?');"
            Runat="server" />
    </ItemTemplate>
    </asp:TemplateField>
    <asp:BoundField DataField="country_name" HeaderText="Country Name" />
    <asp:BoundField DataField="status" HeaderText="Status" />     
     </Columns>
                                <HeaderStyle CssClass="GridHeader" />
                                <AlternatingRowStyle CssClass="GridAlternateRow" />
</asp:GridView>
                            
                                
                                
                                
       <asp:Panel ID="pnlAdd" runat="server" Width="500px" >
      
                                <table cellpadding="2" class="TableWithBorder" style="width:100%; background-color:White">
                        <tr>
                            <td align="right">
                            <asp:Image ID="btnpnlClose" runat="server" ImageUrl="~/images/btn_close.png" alt="" />
                            </td>
                        </tr>
                        <tr>
                        <td>
                            <asp:FormView id="frmAdd" DefaultMode="Insert"
                                
                                Runat="server" OnItemInserted="frmAdd_ItemInserted" 
                                    OnItemCommand="frmAdd_ItemCommand" >
                                
                              <InsertItemTemplate>
                                <div class="scrollBox" style="height:300px;width:500px">    
                                    <table class="TableWithoutBorder" width="100%">
                                        <tr>
                                            <td width="30%" align="right">
                                                <asp:Label ID="lblUserName" Runat="server" AssociatedControlID="txtUserName" 
                                                    Text="Username:" />
                                            </td>
                                            <td width="30%" align="left">
                                                <asp:TextBox ID="txtUserName" Runat="server" CssClass="StandardTextBox" 
                                                    MaxLength="15" Text='<%# Bind("country_name") %>' onchange="javascript:ValidateWhileInserting('frmAdd_txtUserName', 'frmAdd_txtDupUserNameMsg$$frmAdd_btnAdd$$Username already exists')" /><span class="Highlight" style="vertical-align:top">*</span>
                                            </td>
                                            <td width="4%">
                                                &nbsp;</td>
                                            <td width="36%" align="left" colspan="2">
                                                <asp:RequiredFieldValidator ID="rfvAddUsername" runat="server" 
                                                    ControlToValidate="txtUserName" CssClass="Error" Display="Dynamic" 
                                                    ErrorMessage="Required" ForeColor="" ValidationGroup="Add"></asp:RequiredFieldValidator>
                                                <asp:CustomValidator ID="cvCheckUserName" runat="server" 
                                                    ControlToValidate="txtUserName" CssClass="Error" Display="Dynamic" 
                                                    ErrorMessage="Username already exists" 
                                                    onservervalidate="cvCheckUserName_ServerValidate" ValidationGroup="Add"></asp:CustomValidator>
                                                <asp:TextBox ID="txtDupUserNameMsg" runat="server" BorderColor="Transparent" BorderStyle="None" ReadOnly="True" CssClass="Error" Width="200px" TabIndex="-1"></asp:TextBox>
                                            </td>
                                        </tr>
                                        
                                        
                                        <tr>
                                            <td align="right" width="30%">
                                                <asp:Label ID="lblLevel" Runat="server" AssociatedControlID="ddlLevel" 
                                                    Text="Level:" />
                                            </td>
                                            <td align="left" width="30%">
                                                <asp:DropDownList ID="ddlLevel" runat="server" CssClass="StandardTextBox" 
                                                    Width="50px">
                                                    <asp:ListItem Value="A" Text="Active"></asp:ListItem>
                                                    <asp:ListItem Value="I" Text="InActive"></asp:ListItem>
                                                </asp:DropDownList>
                                                <span class="Highlight" style="vertical-align:top">*</span></td>
                                            <td width="4%">
                                                &nbsp;</td>
                                            <td align="left" colspan="2" width="36%">
                                            </td>
                                        </tr>
                                        
                                        <tr>
                                            <td align="left" width="30%">
                                                </td>
                                            <td align="left" width="30%">
                                                &nbsp;</td>
                                            <td width="4%">
                                                </td>
                                            <td align="left" colspan="2" width="36%" valign="top"></td>
                                        </tr>
                                        <tr>
                                            <td colspan="5" align="center">
                                                <table>
                                                    <tr>
                                                        <td>
                                                            <asp:ImageButton ID="btnAdd" runat="server" CommandName="Insert"  
                                                                ValidationGroup="Add" AlternateText="Submit" ImageUrl="~/images/submit.jpg" 
                                                                ToolTip="Add New User"/>
                                                        </td>
                                                        <td>
                                                            <asp:ImageButton ID="btnCancel" runat="server" CommandName="Cancel"  
                                                                CausesValidation="false" AlternateText="Cancel" ImageUrl="~/images/cancel.jpg" 
                                                                ToolTip="Cancel" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                    
        </InsertItemTemplate>
                                
    </asp:FormView>    
                          </td>
                          </tr>
                          </table>  
                            </asp:Panel>
                           
    
                            <cc1:ModalPopupExtender ID="modalpopup1" runat="server" DropShadow="true" TargetControlID="lnkAddCountry"  PopupControlID="pnlAdd" BackgroundCssClass="modalBackground" CancelControlID="btnpnlClose"></cc1:ModalPopupExtender>
                            <%--<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="lnkSearch" PopupControlID="winSearch" BackgroundCssClass="modalBackground"></cc1:ModalPopupExtender>--%>
                            <%--<cc1:DropShadowExtender ID="dse" runat="server"
    TargetControlID="pnlAdd" 
    Opacity=".8" 
    Rounded="true" />--%>
                            <asp:Button id="btnShowPopup" runat="server" style="display:none" />
			                <cc1:ModalPopupExtender  ID="mdlPopup" runat="server" TargetControlID="btnShowPopup" PopupControlID="winEdit" BackgroundCssClass="modalBackground" />

                                <asp:ObjectDataSource ID="odsCountry" runat="server"  
                                    TypeName="Country" SelectMethod="SelectAllCountry">
                                   <SelectParameters>
                                   <asp:ControlParameter ControlID="txtSearchCountryname" Name="countryname" DefaultValue=" " />
                                   </SelectParameters>
                                   
                                    </asp:ObjectDataSource>
                            
                               <%-- <asp:ObjectDataSource ID="odsEditUser" runat="server" SelectMethod="SelectUserById" 
                                    TypeName="ManageUser" 
                                    UpdateMethod="UpdateUser" OnUpdated="odsEditUser_Updated" 
                                    OnDeleted="odsEditUser_Deleted">
                                    <UpdateParameters>
                                        <asp:ControlParameter ControlID="gvUser"  Name="user_id" 
                                            PropertyName="SelectedValue" DefaultValue="" />
                                    </UpdateParameters>
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="gvUser"  Name="user_id" 
                                            PropertyName="SelectedValue" DefaultValue="0"/>
                                    </SelectParameters>
                                </asp:ObjectDataSource>--%>
                               
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;
                            </td>
                        </tr>
                    </table>
          </div>
          
         
          </td>
      </tr>
    </table>

</asp:Content>

